/*      
 *  
 *  功能：春节红包
 *  
 */
var status = 0;
var itemList = Array(
        Array(3010013, 75, 1, 0), //悠长假期
        Array(3010014, 80, 1, 0), //月亮弯
        Array(3010018, 86, 1, 0), //椰子树沙滩椅
        Array(3010019, 89, 1, 0), //寿司椅
        Array(3010021, 33, 1, 0), //暖暖桌
        Array(3010025, 150, 1, 0), //枫叶纪念凳
        Array(3010028, 22, 1, 0), //海盗的俘虏
        Array(3010029, 15, 1, 0), //蓝环凳
        Array(3010030, 155, 1, 0), //黑环凳
        Array(3010031, 150, 1, 0), //红环凳
        Array(3010032, 145, 1, 0), //黄环凳
        Array(3010033, 150, 1, 0), //绿环凳
        Array(3010037, 188, 1, 0), //猪猪凳
        Array(3010044, 150, 1, 0), //同一红伞下
        Array(3012001, 170, 1, 0), //篝火
        Array(3012002, 150, 1, 0), //浴桶
        Array(3010073, 100, 1, 0), //PB克缤
        Array(3012003, 150, 1, 0), //爱心椅子
        Array(3010012, 150, 1, 0), //剑士 宝座
        Array(3010025, 150, 1, 0), //枫叶纪念凳
        Array(3010037, 150, 1, 0), //猪猪凳
        Array(3010038, 150, 1, 0), //爱心椅子
        Array(3010040, 150, 1, 0), //蝙蝠椅
        Array(3010041, 150, 1, 0), //骷髅王座
        Array(3010043, 150, 1, 0), //魔女的飞扫把
        Array(3010044, 150, 1, 0), //同一红伞下
        Array(3010045, 150, 1, 0), //寒冰椅子
        Array(3010046, 150, 1, 0), //红龙椅
        Array(3010047, 200, 1, 0), //蓝龙椅
        Array(3010048, 200, 1, 0), //圣诞树椅子
        Array(3010049, 200, 1, 0), //雪房子
        Array(3010050, 200, 1, 0), //公主凳
        Array(3010057, 200, 1, 0), //血色玫瑰
        Array(3010058, 200, 1, 0), //世界末日
        Array(3010068, 200, 1, 0), //露水椅子
        Array(3010070, 15, 1, 1), //巨无霸品克缤
        Array(3010071, 121, 1, 0), //神兽椅
        Array(3010077, 122, 1, 0), //猫头鹰椅子
        Array(3010085, 123, 1, 0), //鬼娃娃椅子
        Array(3010096, 124, 1, 0), //恐龙化石宝座
        Array(3010095, 125, 1, 0), //石头人座椅
        Array(3010094, 215, 1, 0), //漂漂猪椅子
        Array(3010098, 125, 1, 0), //电视宅人
        Array(3010106, 127, 1, 0), //雪狼战椅
        Array(3010112, 128, 1, 0), //情书柜子
        Array(3010117, 129, 1, 0), //魔法书椅子
        Array(3010119, 145, 1, 0), //羊羊椅子
        Array(3010120, 141, 1, 0), //彩蛋篮子
        Array(3010123, 145, 1, 0), //夏日花朵
        Array(3010124, 148, 1, 0), //都纳斯喷气椅子
        Array(3010125, 147, 1, 0), //尼贝隆战舰椅
        Array(3010127, 150, 1, 0), //扎昆宝座
        Array(3012001, 151, 1, 0), //篝火
        Array(3010136, 152, 1, 0), //6周年怪物王座
        Array(3010155, 152 * 2, 1, 0), //暗影双刀的猫头鹰椅子
        Array(3010144, 153 * 2, 1, 0), //七夕椅子
        Array(3010149, 154 * 2, 1, 0), //猫咪风扇椅
        Array(3010129, 155 * 2, 1, 0), //酋长宝座
        Array(3010131, 156 * 2, 1, 0), //贪吃熊猫椅
        Array(3010132, 157 * 2, 1, 0), //撒娇喵咪椅
        Array(3010133, 158 * 2, 1, 0), //帐篷椅
        Array(3010163, 159 * 2, 1, 0), //满月椅
        Array(1003622, 100, 1, 1), //布莱克缤帽 
        Array(1003621, 200, 1, 1), //混沌品克缤帽 
        Array(1003780, 100, 1, 1), //自由品克缤帽 
        Array(1003781, 102, 1, 1), //自由布莱克缤帽 
        Array(1052526, 103, 1, 1), //混沌品克缤大衣 
        Array(1052527, 104, 1, 1), //布莱克缤大衣 
        Array(1052588, 105, 1, 1), //自由品克缤连身衣 
        Array(1052589, 106, 1, 1), //自由布莱克缤连身衣 
        Array(1212072, 107, 1, 1), //布莱克缤双头杖 
        Array(1222067, 108, 1, 1), //布莱克缤灵魂手铳 
        Array(1232064, 109, 1, 1), //布莱克缤亡命剑 
        Array(1242069, 110, 1, 1), //布莱克缤能量剑 
        Array(1242070, 111, 1, 1), //布莱克缤能量剑 
        Array(1302070, 112, 1, 1), //布莱克缤单手剑 
        Array(1312142, 113, 1, 1), //布莱克缤单手斧 
        Array(1322100, 114, 1, 1), //布莱克缤单手钝器 
        Array(1332214, 115, 1, 1), //布莱克缤短刀 
        Array(1342079, 116, 1, 1), //布莱克缤双刀 
        Array(1362081, 118, 1, 1), //布莱克缤手杖 
        Array(1372168, 120, 1, 1), //布莱克缤短杖 
        Array(1382199, 130, 1, 1), //布莱克缤长杖 
        Array(1402185, 140, 1, 1), //布莱克缤双手剑 
        Array(1412126, 150, 1, 1), //布莱克缤双手斧 
        Array(1422129, 160, 1, 1), //布莱克缤双手钝器 
        Array(1432158, 170, 1, 1), //布莱克缤长枪 
        Array(1442209, 180, 1, 1), //布莱克缤长矛 
        Array(1452196, 190, 1, 1), //布莱克缤弓 
        Array(1462184, 210, 1, 1), //布莱克缤弩 
        Array(1472205, 220, 1, 1), //布莱克缤拳套 
        Array(1482159, 230, 1, 1), //布莱克缤指节 
        Array(1492170, 240, 1, 1), //布莱克缤短枪 
        Array(1522085, 270, 1, 1), //布莱克缤双弩枪 
        Array(1532089, 250, 1, 1), //布莱克缤火炮 
        Array(3010592, 260, 1, 1), //布莱克缤椅子
//暴君系列转蛋
        Array(1072746, 50, 1, 1), //暴君利卡昂靴
        Array(1082546, 50, 1, 1), //暴君利卡昂手套
        Array(1102484, 50, 1, 1), //暴君利卡昂披风
        Array(1132177, 50, 1, 1), //暴君利卡昂腰带

//冒险之心系列转蛋
        Array(4033755, 800, 1, 0), //心之项链链子
        Array(2431559, 850, 1, 1), //冒险岛勇士之心(飞侠)
        Array(2431564, 900, 1, 1), //高级冒险岛勇士之心(飞侠)
        Array(2431560, 950, 1, 1), //冒险岛勇士之心(海盗)
        Array(2431565, 945, 1, 1), //高级冒险岛勇士之心(海盗)
        Array(2431558, 960, 1, 1), //冒险岛勇士之心(弓箭手)
        Array(2431563, 962, 1, 1), //高级冒险岛勇士之心(弓箭手)
        Array(2431557, 840, 1, 1), //冒险岛勇士之心(法师)
        Array(2431562, 834, 1, 1), //高级冒险岛勇士之心(法师)
        Array(2431556, 861, 1, 1), //冒险岛勇士之心(战士)
        Array(2431561, 956, 1, 1), //高级冒险岛勇士之心(战士)
//意志肩饰腰带转蛋
        Array(4033667, 800, 1, 0), //意志盒

        Array(1112915, 100, 1, 1) //蓝调戒指
        );
function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 0) {
        cm.dispose();
        return;
    } else {
        status++;
    }
    var random = new java.util.Random();
    if (status == 0) {
        var chance = random.nextInt(999);
        var finalitem = Array();
        for (var i = 0; i < itemList.length; i++) {
            if (itemList[i][1] >= chance && itemList[i][1] <= chance + 100) {
                finalitem.push(itemList[i]);
            }
        }
        if (finalitem.length != 0) {
            var finalchance = random.nextInt(finalitem.length);
            var itemId = finalitem[finalchance][0];
            var quantity = finalitem[finalchance][2];
            cm.gainItem(itemId, quantity);
            cm.sendOk("你获得了 #b#t" + itemId + "##k " + quantity + "个。");
        } else {
            var random = new java.util.Random();
            var mesos = (random.nextInt(8) + 1) * 10000000;
            cm.gainMeso(mesos);
            cm.sendOk("恭喜你获得了 " + mesos + " 金币");
        }
    }
    cm.dispose();
}
